package top.fzqblog.firstapp;

import android.app.Activity;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.util.Log;
import android.widget.ArrayAdapter;
import android.widget.ListView;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by 抽离 on 2017/8/14 0014.
 */

public class SecondActivity extends Activity {

    private List<String> list;

    private ArrayAdapter<String> arrayAdapter;

    private ListView listView;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.second_activity);
        init();
        listView = (ListView) findViewById(R.id.lv);
        listView.setAdapter(arrayAdapter);
        Log.i("tag", "-------second---onCreate");
    }

    private void init(){
        list = new ArrayList<>();
        for (int i = 1; i < 40 ; i++) {
            list.add("项目" + i);
        }
        arrayAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, list);
    }

    @Override
    protected void onStart() {
        super.onStart();
        Log.i("tag", "------second----onStart");
    }

    @Override
    protected void onRestart() {
        super.onRestart();
        Log.i("tag", "------second----onRestart");
    }

    @Override
    protected void onResume() {
        super.onResume();
        Log.i("tag", "------second----onResume");
    }

    @Override
    protected void onPause() {
        super.onPause();
        Log.i("tag", "------second----onPause");
    }

    @Override
    protected void onStop() {
        super.onStop();
        Log.i("tag", "------second----onStop");
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        Log.i("tag", "------second----onDestroy");
    }
}
